package alp.starcode.seller.controller;

import alp.starcode.framework.utils.JSONResult;
import alp.starcode.framework.utils.Paging;
import alp.starcode.seller.service.SellService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

@Api("卖家接口")
@RestController
@RequestMapping("sell")
public class SellController {

    @Autowired
    SellService sellService;

    @ApiOperation("获取店铺信息(分页)")
    @GetMapping("getAllStoreInfo.do")
    public JSONResult getAllStoreInfo(Paging paging,String search){
        return JSONResult.ok(sellService.getStoreInfos(paging,search));
    }


    @ApiOperation("获取店铺下的所有商品")
    @GetMapping("getMerchandiseByStoreUuid.do")
    public JSONResult getMerchandiseByStoreUuid(String storeUuid){
        return JSONResult.ok(sellService.getMerchandiseByStoreUuid(storeUuid));
    }

    @ApiOperation("获取所有评论")
    @GetMapping("getAllComment.do")
    public JSONResult getAllComment(String storeUuid, HttpSession httpSession){
        return JSONResult.ok(sellService.getAllComment(storeUuid,httpSession));
    }
}
